
const Mock = require('mockjs'); // 假数据

module.exports = function (app) {
    const prefix = '/api/business/';

    /*
        {
            "title": '业务下拉框',
            "url":'/api/business/droplist',
            "method": 'get',
            "params":{
            },
            "response":{
                "code": "200",
                "msg": "",
                "data":{
                    list:[{
                        'id': 0, // ID
                        'name': '', // 业务名称
                    }]
                }
            }
        }
    */
    app.get(prefix + 'droplist', (req, res) => {
        const code = 200;
        const msg = '';
        const data = Mock.mock({ // 生成
            'list|20': [{
                'id': '@increment(100)',
                'name': '@cname'
            }]
        });
        const time = +(new Date);
        const result = {code, data, msg, time};
        return res.end(JSON.stringify(result));
    });

};
